<%@ Page Language="C#" Theme="Defaultsys" AutoEventWireup="true" CodeFile="User.aspx.cs"
    Inherits="User" Title="Rapport Plan System - User" MasterPageFile="~/MasterPage.master" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1">

    <script language="javascript" type="text/javascript">
	
		function ValidateLogin(oSrc, args)
		{
		    alert("");
		    var obj = document.getElementById('ctl00_ContentPlaceHolder1_wzCreateUser_chkLoginPassword');
            args.IsValid = true;
            
            str=Trim(args.Value);
            
            if ( (obj.checked == false) && (str.length == 0) )
                args.IsValid = false;
        }
        
        function ValidateSymbols(oSrc, args)
        {
            args.IsValid = true;
            str = args.Value;
            for (i=0; i<str.length; i++ )
            { 
                if ((str.charAt(i) == '<') || (str.charAt(i)=='>'))
                    args.IsValid = false;
            }
        }
		
    </script>

    <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td class="contTable">
                <table>
                    <tr>
                        <td Width="30%">
                            First name:</td>
                        <td Width="30%">
                            <asp:TextBox ID="txtFirstName" runat="server" MaxLength="255" Width="100%"></asp:TextBox>
                            
                        </td>
                        <td><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFirstName"
                                CssClass="error" ErrorMessage="First Name is required" SetFocusOnError="True"
                                Display="Dynamic">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Last name:</td>
                        <td>
                            <asp:TextBox ID="txtLastName" runat="server" MaxLength="255" Width="100%"></asp:TextBox>
                           
                        </td>
                        <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtLastName"
                                CssClass="error" ErrorMessage="Last Name is required" SetFocusOnError="True"
                                Display="Dynamic">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            User name: &nbsp;</td>
                        <td>
                            <asp:TextBox ID="txtConnectName" runat="server" MaxLength="255" Width="100%"></asp:TextBox></td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtConnectName"
                                CssClass="error" ErrorMessage="ConnectName is required" SetFocusOnError="True"
                                Display="Dynamic">*</asp:RequiredFieldValidator>
                            <asp:CustomValidator ID="CustomValidator6" runat="server" ClientValidationFunction="ValidateSymbols"
                                ControlToValidate="txtConnectName" Display="Dynamic" ErrorMessage="*" SetFocusOnError="True"></asp:CustomValidator>
                            <asp:Label ID="lblSteluta" runat="server" ForeColor="Red" Text="*" Visible="False"
                                Width="11px"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Password:
                        </td>
                        <td>
                            <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Width="100%" MaxLength="255"></asp:TextBox>
                            </td>
                        <td><asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtPassword"
                                CssClass="error" ErrorMessage="Password is required" SetFocusOnError="True" Display="Dynamic">*</asp:RequiredFieldValidator>
                        
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Password confirmation:</td>
                        <td>
                            <asp:TextBox ID="txtRepassword" runat="server" TextMode="Password" Width="100%"
                                MaxLength="255"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="txtRepassword"
                                CssClass="error" ErrorMessage="Password confirmation is required" SetFocusOnError="True"
                                Display="Dynamic">*</asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="vldPasswordConf" ControlToValidate="txtRepassword" ControlToCompare="txtPassword"
                                Type="String" runat="server" SetFocusOnError="true" Operator="Equal" Display="Dynamic">*</asp:CompareValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Role:</td>
                        <td>
                            <asp:DropDownList Width="100%" ID="cmbRoles" runat="server" >
                            </asp:DropDownList>
                            </td>
                        <td><asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="cmbRoles"
                                CssClass="error" ErrorMessage="Role is required" SetFocusOnError="True" Display="Dynamic">*</asp:RequiredFieldValidator>
                        
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Email:</td>
                        <td>
                            <asp:TextBox ID="txtEmail" runat="server" MaxLength="255" Width="100%"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="txtEmail"
                                CssClass="error" ErrorMessage="Email is required" SetFocusOnError="True" Display="Dynamic">*</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Incorect e-mail address"
                                ControlToValidate="txtEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                Display="Dynamic">*</asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Active:</td>
                        <td>
                            <asp:CheckBox ID="chkActive" runat="server" Checked="True" /></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            View all contacts:</td>
                        <td>
                            <asp:CheckBox ID="chkViewAllContacts" runat="server" /></td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Button ID="btnSave" runat="server" OnClick="Save" Text="Save" />
                            <asp:Button ID="btnCancel" runat="server" OnClick="Cancel" Text="Cancel" CausesValidation="false" />
                            <br />
                            <asp:Label ID="lblSavedUser" runat="server" ForeColor="#FF8000" Text="The user was saved successfully"
                                Visible="False"></asp:Label></td>
                        <td colspan="1">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtFirstName"
                                CssClass="error" SetFocusOnError="True" ErrorMessage="(*)First Name is required"
                                Display="Dynamic"></asp:RequiredFieldValidator>
                            <asp:Label ID="lblUserExist" runat="server" Text="(*)User already exist in database!"
                                Visible="False" Width="251px" ForeColor="Red"></asp:Label></td>
                        <td colspan="1">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtLastName"
                                CssClass="error" Display="Dynamic" SetFocusOnError="True" ErrorMessage="(*)Last Name is required"></asp:RequiredFieldValidator>
                        </td>
                        <td colspan="1">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="txtConnectName"
                                CssClass="error" Display="Dynamic" SetFocusOnError="True" ErrorMessage="(*)User Name is required"></asp:RequiredFieldValidator>
                            <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidateSymbols"
                                ControlToValidate="txtConnectName" Display="Dynamic" ErrorMessage="The symbols '<' and '>' are not allowed"
                                SetFocusOnError="True"></asp:CustomValidator>
                        </td>
                        <td colspan="1">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="txtPassword"
                                CssClass="error" Display="Dynamic" SetFocusOnError="True" ErrorMessage="(*)Password is required"></asp:RequiredFieldValidator>
                        </td>
                        <td colspan="1">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="txtRepassword"
                                CssClass="error" Display="Dynamic" SetFocusOnError="True" ErrorMessage="(*)Password confirmation is required"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="CompareValidator1" ControlToValidate="txtRepassword" ControlToCompare="txtPassword"
                                Type="String" runat="server" SetFocusOnError="true" Operator="Equal" ErrorMessage="(*)Please enter twice the same password"
                                Display="Dynamic"></asp:CompareValidator>
                        </td>
                        <td colspan="1">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ControlToValidate="txtEmail"
                                CssClass="error" Display="Dynamic" SetFocusOnError="True" ErrorMessage="(*)Email is required"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="(*)Incorect e-mail address"
                                ControlToValidate="txtEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                Display="Dynamic"></asp:RegularExpressionValidator>
                        </td>
                        <td colspan="1">
                        </td>
                    </tr>
                </table>
                <div id="divClient" style="display: none">
                    &nbsp;</div>
            </td>
        </tr>
    </table>
</asp:Content>
